import request from "@/utils/request";

// 查询产品BOM关系列表
export function listBom(query) {
  return request({
    url: "/mes/md/bom/list",
    method: "get",
    params: query,
  });
}
export function routeBOMList(query) {
  return request({
    url: "/mes/md/bom/routeBOMList",
    method: "get",
    params: query,
  });
}

export function sonList(query) {
  return request({
    url: "/mes/md/bom/sonList",
    method: "get",
    params: query,
  });
}

export function proBOMList(query) {
  return request({
    url: "/mes/pro/routeproductbom/routeBOMList", // /mes/md/bom/routeBOMList/notPage 原來的
    method: "get",
    params: query,
  });
}

//生产补料查询接口
export function getBOMList(query) {
  return request({
    url: "/mes/pro/routeproductbom/replenishment",
    method: "get",
    params: query,
  });
}

export function listBomSon(query) {
  return request({
    url: "/mes/md/bom/sonList",
    method: "get",
    params: query,
  });
}

// 查询分类下拉树结构
export function treeselect() {
  return request({
    url: "/mes/md/itembomtype/treeselect",
    method: "get",
  });
}

// 查询产品BOM关系详细
export function getBom(itemIds) {
  return request({
    url: "/mes/md/bom/" + itemIds,
    method: "get",
  });
}

// 新增产品BOM关系
export function addBom(data) {
  return request({
    url: "/mes/md/bom",
    method: "post",
    data: data,
  });
}

// 修改产品BOM关系
export function updateBom(data) {
  return request({
    url: "/mes/md/bom",
    method: "put",
    data: data,
  });
}

// 删除产品BOM关系
export function delBom(bomId) {
  return request({
    url: "/mes/md/bom/" + bomId,
    method: "delete",
  });
}

// export function synchronousData(query) {
//   return request({
//     url: "/mes/k3cloud/api/materialBom/syncMaterialBomList",
//     method: "get",
//     params: query,
//   });
// }

export function synchronousData(query) {
  return request({
    url: "/sync/k3cloud/api/productBomSync/productBomSync",
    method: "get",
    params: query,
  });
}
